import { TemplateRef } from '@angular/core';
import { NavigationExtras } from '@angular/router';

// 间距
export type LvGutter = 'none' | number | string;

// 排序
export type LvSortDirection = 'asc' | 'desc' | '';
export type LvPureSortDirection = 'asc' | 'desc';

export type LvFilterMode = 'contains' | 'endsWith' | 'startsWith' | 'equals' | 'in' | 'timeIn' | 'rangeIn';

export type LvPositionTB = 'top' | 'bottom';

export type LvSelectSM = 'single' | 'multiple';
export type LvSelectPCB = 'parent' | 'child' | 'both';

export type LvSizeLSD = 'large' | 'default' | 'small';
export type LvSizeLD = 'large' | 'default';
export type LvSizeSD = 'small' | 'default';

export type LvFormLayoutType = 'horizontal' | 'vertical';

// 日期、时间
export type LvHourMode = '12' | '24';
export type LvTimeFormat = 'HH:mm:ss' | 'HH:mm' | 'mm:ss' | 'hh:mm a' | 'hh:mm A' | 'hh:mm:ss a' | 'hh:mm:ss A';
export type LvDateMode = 'year' | 'month' | 'date' | 'simple';
export type LvDateRangeTag = 'start' | 'end';
export type LvCalendarMode = 'year' | 'month';

export type LvRouterLinkType = string | [string | any[], NavigationExtras?]; // NEED_DO：适配原有类型，后续整体整改，删除any

// overlay
export type LvPositionType =
  | 'top'
  | 'topLeft'
  | 'topRight'
  | 'right'
  | 'rightTop'
  | 'rightBottom'
  | 'bottom'
  | 'bottomLeft'
  | 'bottomRight'
  | 'left'
  | 'leftTop'
  | 'leftBottom';

export interface MenuItem {
  id: string;
  label: string | TemplateRef<void>;
  tips?: string;
  icon?: string;
  width?: string;
  onClick?: (event?: any) => void;
  routerLink?: LvRouterLinkType;
  items?: MenuItem[];
  expanded?: boolean;
  disabled?: boolean;
  hidden?: boolean;
  divide?: boolean;
  type?: string;
}

export interface FilterConfig {
  key?: string;
  value: any;
  filterMode?: LvFilterMode; // default: startsWith
  // customFilter?: <T>(data: T[] | null, filter: FilterConfig) => T[] | null; 每个组件自定义有所不同，在各自接口定义
  caseSensitive?: boolean; // default: false
}

export interface BaseTreeNode {
  key?: string;
  data?: any;
  expanded?: boolean; // 是否展开子项
  // unfold?: boolean; // 是否展开子项
  disabled?: boolean;
  isLeaf?: boolean;
  parent?: BaseTreeNode;
  children?: BaseTreeNode[];
}

export interface LvCalendarEvents {
  [key: string]: any;
  id?: number;
  title: string;
  startDate: Date;
  endDate?: Date;
}

export type LvListItemLayout = 'horizontal' | 'vertical';
export type LvTagAlarmStatus = 'critical' | 'major' | 'minor' | 'warning' | 'customize';

export type LvLoadingSize = 'mini' | 'small' | 'medium' | 'default';
